package com.boang;

import com.boang.config.MD5;
import org.apache.tomcat.util.security.MD5Encoder;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

@SpringBootApplication
@MapperScan("com.boang.mapper")
public class SpringbootSecurityApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringbootSecurityApplication.class, args);

        BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
        String encode = passwordEncoder.encode("123456");
        System.out.println(encode);
//        $2a$10$dZHB8BB9jC.RqU98VX7OB.4LcCg7yKDTqTTqmfAJQ1M87l9cywTc.
//        $2a$10$yS5Io0DTasi2SEi9nzJBjeF4YAMg/FkPJK5NoaWzoUKdKrEWGLZ16
//        $2a$10$AStE2pUx0e4U3gE7ghE6g.EpZO0xLKg3dENeBAB0OZE63qsbT0bXi

        boolean matches = encode.matches("$2a$10$yS5Io0DTasi2SEi9nzJBjeF4YAMg/FkPJK5NoaWzoUKdKrEWGLZ16");
        System.out.println(matches);

    }

}
